#include <iostream>
#include <vector>
#include <Vector.hpp>

using namespace std;

class Solution
{
public:
    vector<int> plusOne(vector<int> &digits)
    {
        int append = 1;
        for (int i = digits.size() - 1; i >= 0; i--)
        {
            int sum = digits[i] + append;
            digits[i] = sum % 10;
            append = sum / 10;
        }
        if (append == 1)
        {
            vector<int> res(digits.size() + 1);
            res[0] = 1;
            copy(digits.begin(), digits.end(), res.begin() + 1);
            return res;
        }
        return digits;
    }
};

int main()
{
    cout << "Code66" << endl;
    Solution s;
    vector<int> v{9,9,9};
    PrintVector(s.plusOne(v));
    return 0;
}